﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Utils.Wpf.Converters
{
	public class NegatedBooleanToVisibilityConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			Visibility falseValue = parameter == null ? Visibility.Collapsed : (Visibility)Enum.Parse(typeof(Visibility), parameter.ToString());

			if (!(bool)value)
			{
				return Visibility.Visible;
			}
			else
			{
				return falseValue;
			}
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
}
